<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="./ajax.js"></script>
</head>
<body>
	<form action="http://localhost:8080/login/" method="get" accept-charset="utf-8">
		用户：<input type="text" id="user" name="user" value=""><br>
		密码：<input type="text" id="pass" name="pass" value=""><br>
		<input type="button" name="" value="提交" id="login_btn">
	</form>
	<script type="text/javascript">
		var user = document.getElementById('user')
		var pass = document.getElementById('pass')
		var login_btn = document.getElementById('login_btn')
		login_btn.onclick = function(){
			ajax({
				url: 'login',
				type: 'get',
				data: {
					user: user.value,
					pass: pass.value,
				},
				success: function(data){
					var json = eval('('+ data +')')
					alert(json.msg)
				},
				error: function(err){

				}
			})
		}
		
	</script>
</body>
</html>